package com.easondongh.common.advice;

import com.easondongh.common.enums.ResponseEnum;
import com.easondongh.common.response.ResponseObj;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

/**
 * @author EasonDongH
 * @date 2020/6/18 8:58
 */
@RestControllerAdvice
public class GlobalExceptionHanderAdvice {
    /**
     * 未授权
     */
    @ExceptionHandler(value= {UnauthorizedException.class})
    public ResponseObj unauthorized() {
        return new ResponseObj(ResponseEnum.UNAUTHORIZED);
    }
}
